package com.crm.model.business;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Entity
@Table(name = "eo_paper")
public class Paper {
    /**
     * 编号
     */
    private int id;
    /**
     * 试卷名
     */
    private String name;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 考试：一试卷对多考试
     */
    private List<Exam> examList;
    /**
     * 题目：一试卷对多题目
     */
    private List<Question> questionList;

    @Id
    @GeneratedValue(generator = "_native")
    @GenericGenerator(name = "_native", strategy = "native")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @OneToMany(mappedBy = "paper", cascade = {CascadeType.REMOVE})
    public List<Exam> getExamList() {
        return examList;
    }

    public void setExamList(List<Exam> examList) {
        this.examList = examList;
    }

    @OneToMany(mappedBy = "paper", fetch = FetchType.EAGER)
    public List<Question> getQuestionList() {
        return questionList;
    }

    public void setQuestionList(List<Question> questionList) {
        this.questionList = questionList;
    }
}
